package xhwl.insurance.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.insurance.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by Administrator on 2017/10/10.
 * 论坛提问发送帖子
 */

public class SendForumApi extends BaseApi {


    private final SendForumReq req;

    public SendForumApi(String member_id, String post_title,String post_urls,String post_details, String post_type,String voice_long) {
        req = new SendForumReq(member_id, post_title,post_urls,post_details,post_type,voice_long);
        setShowDialog(true);
        setCancle(false);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).SendForum(requestBody);
    }

    private class SendForumReq {
        private String member_id;
        private String post_title;
        private String post_urls;
        private String post_details;
        private String post_type;
        private String voice_long;
        public SendForumReq(String member_id, String post_title,String post_urls,String post_details, String post_type,String voice_long) {
            super();
            this.member_id = member_id;
            this.post_title = post_title;
            this.post_urls = post_urls;
            this.post_details = post_details;
            this.post_type = post_type;
            this.voice_long = voice_long;
        }
    }
}
